/**
 * GarinDriver -- Eclipse Public License - v 1.0
 * http://www.eclipse.org/legal/epl-v10.html
 */
package garin.parse.io;

import garin.parse.Token;

import java.io.IOException;

/**
 * Source for content
 * <p>
 * This is basically a simplified stream.
 * 
 * @author Mark Farnsworth
 */
public interface Source {
	/**
	 * @return position
	 */
	long at();
	
	/**
	 * @return a char
	 */
	char ch();
	
	/**
	 * @param start
	 * @param b
	 * @throws IOException
	 */
	String contents(long start, long end) throws IOException;
	
	/**
	 * reads a char
	 * 
	 * @return true if we were able to read something
	 * @throws IOException
	 */
	boolean go() throws IOException;
	
	/**
	 * @param pos
	 *            Position to goto
	 * @return true if we were able to go
	 * @throws IOException
	 */
	boolean go(long pos) throws IOException;
	
	boolean is(String open) throws IOException;
	
	boolean is(final String match, final boolean cs) throws IOException;
	
	boolean isWhitespace();
	
	void read(Token token) throws Exception;
	
	SetValueObserver setValueObserver();
	
	void setValueObserver(SetValueObserver o);
}
